from flask import Flask

from ._imports import modules

__all__ = ['start_server']

app = Flask(__name__)
# 加载模块
for module in modules:
    app.register_blueprint(module)


def start_server(host: str = '0.0.0.0', port: int = None, *, debug: bool = False, **options):
    """
    启动 Web 服务器

    :param host: 监听的主机名
    :param port: 端口号
    :param debug: 调试模式
    :param options: 配置
    """
    app.run(host=host, port=port, debug=debug, **options)
